package com.university.mentalhealthplatform.studentV3.service;

import com.university.mentalhealthplatform.appModels.Tweet;
import com.university.mentalhealthplatform.studentV3.repository.TweetRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class TweetServiceV3 {

    @Autowired
    private TweetRepository tweetRepository;

    public List<Tweet> getAllTweets() {
        return tweetRepository.findAll();
    }

    public Tweet getTweetById(Long id) {
        Optional<Tweet> tweet = tweetRepository.findById(id);
        return tweet.orElse(null);
    }
}
